import React, { Component } from 'react';

import './index.scss';

export default class TableBody extends Component {


    render() {

        const { studentData, onStatusClick } = this.props;

        return (
            <tbody>
                {
                    studentData.map((item, index) => {
                        return (
                            <tr key={index}  className='list-tr'>
                                <td>{item.sid}</td>
                                <td>
                                   <img
                                     className="student-img"
                                     src={`http://tximg.xumanplus.xyz/${item.studentImgKey}`}
                                     alt={item.studentName} />
                                </td>
                                <td>
                                        {item.studentName} 
                                </td>
                                <td className="course-name">{item.intro}</td>
                                <td className="course-name">{item.courseName}</td>
                                <td>
                                    <button
                                        className={['btn', item.status ? 'btn-danger' : 'btn-success'].join(' ')}
                                         onClick={() => onStatusClick(item.id, index)}
                                    >
                                        {item.status ? '下线' : '上线'}
                                    </button>
                                </td>
                            </tr>
                        )
                    })
                }
            </tbody>
        )
    }
}